package com.md.application.service;


import com.md.api.OpenUsersApi;
import com.md.domain.service.AuthenticationDomainServices;
import com.md.model.system.CommonResult;
import com.md.request.RegisterUsersRequest;
import com.md.request.open.CheckPermissionRequest;
import com.md.request.open.QuerySimpleUsersRequest;
import com.md.request.open.QueryUsersRequest;
import com.md.response.UsersResponse;
import com.md.response.open.SimpleUsersResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author 刘骄阳
 * 2024-12-15 1:46
 */
@Service
@RequiredArgsConstructor
public class OpenUsersApplication implements OpenUsersApi {
  private final AuthenticationDomainServices authenticationDomainServices;

  @Override
  public CommonResult<UsersResponse> registerUsers(final RegisterUsersRequest request) {
    return null;
  }

  @Override
  public CommonResult<UsersResponse> queryUserInfo(final QueryUsersRequest request) {
    return CommonResult.success(authenticationDomainServices.queryUserInfo(request.getId()));
  }

  @Override
  public CommonResult<Boolean> checkPermission(final CheckPermissionRequest request) {
    return CommonResult.success(authenticationDomainServices.checkPermission(request.getUserId(), request.getApiId()));
  }

  @Override
  public CommonResult<SimpleUsersResponse> simpleInfo(final QuerySimpleUsersRequest request) {
    return CommonResult.success(authenticationDomainServices.simpleInfo(request.getPhone(), request.getAccount()));
  }
}
